<?php 
	session_start(); 
	include('user_type/system.php');
	//include('user_type/member.php');
	//include('user_type/moderator.php');
	include('access/login_functions.php');
	$_SESSION['restricted'] = false;
	//$user = $_SESSION['userType'];
	
	if(isset($_SESSION['Status'])){
		if ($_SESSION['Status'] == "NewModerator") { send_to_page('firstTimeLogin.php'); }
		}
?>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>	
	<link rel="stylesheet" type="text/css" href="style_new.css">

	<title>Quest - Home Page</title>
	<script type="text/javascript" src="js/tools.js"></script>
 
</head>
<body onload="set_to_search_bar()">

<div class="above_body"> <!-- closing tag is in template navbar -->
	<div id="header" class="floatcontainer doc_header">
		<!--div><a name="top" href="" class="logo-image"><img src="images/questwtrl2.png"  title=""></a></div-->
		
			<div id="toplinks" class="toplinks">
			<?php $_SESSION['showResults'] = false; ?>
				<ul class="nouser">
					<?php if (!isset($_SESSION['user'])) echo "<li><a href=\"register.php\" rel=\"nofollow\">Register</a></li>"; ?>
					<li>
					
					<form id="navbar_loginform" action="access/login.php" method="post" >
					<input type="hidden" name="currentPage" value="<?php echo System::curPageName(); ?>" />
						<fieldset id="logindetails" class="logindetails">
							<div>
								<div>
							
							<?php // check if user is logged in
							if(isset($_SESSION['user']))
							{	
								$user = $_SESSION['user'];
								$_SESSION['curPage'] = System::curPageName(); 
								// if so, display username with tools
								echo "<div style=\"font-size: 16px; font-weight: bold;\">";
								echo "Welcome, $user <br />";
								echo "<a href=\"access/logout.php\">Log Out</a>";
								echo "<a href=\"userTools.php\">myTools</a>";
								echo "<a href=\"userInfo.php\">myProfile</a>";
								
								echo "</div>";
							}
							else
							{	// otherwise, display login form
								echo "<input type=\"text\" class=\"textbox default-value\" name=\"user\" id=\"navbar_username\" size=\"10\" tabindex=\"101\" value=\"Username\" onfocus=\"if(!this._haschanged){this.value=''};this._haschanged=true;\"> ";
								echo "<input type=\"password\" class=\"textbox default-value\" tabindex=\"102\" name=\"pass\" id=\"navbar_password_hint\" size=\"10\" value=\"Password\" style=\"display: inline; \" onfocus=\"if(!this._haschanged){this.value=''};this._haschanged=true;\"> ";
								echo "<input type=\"submit\" class=\"loginbutton\" tabindex=\"104\" value=\"Log in\" title=\"Enter your username and password in the boxes provided to login.\" accesskey=\"s\">";
							}
						?>
								</div>
								
							</div>
						</fieldset>
					</form>
					</li>
				</ul>
			</div>
	</div> 
	<br />
	<div id="navbar" class="navbar">

		<ul id="navtabs" class="navtabs floatcontainer">					
		</ul>
	</div>
</div><!-- closing div for above_body -->

<form action="Captcha.php" id="mainsearch" method="post" class="vbform block">
	<h2 class="blockhead"></h2>
	<div class="blockbody formcontrols">
		<div class="section">
			<div class="blockrow">
				<ul class="group">
					<li>
						<center><a href=""><img src="images\QUEST.png"/></a></center>
					</li>
					<li>
						<center><input type="text" class="textbox" name="search" id="search" maxlength="50" value="" dir="ltr" tabindex="1"></center>
					</li>
				</ul>
			</div>
			<div class="blockrow">
				<li>
					<center>
						<input type="submit" class="button" name="searchType" value="    Search Articles    " tabindex="1" accesskey="s">
						<input type="submit" class="button" name="searchType" value="    Search Images    " tabindex="1" accesskey="s">
					</center>
				</li>
			</div>
						<?php 
							if (isset($_SESSION['captchaWarning']) && isset($_SESSION['user']))
								echo $_SESSION['captchaWarning'];
							unset($_SESSION['captchaWarning']);
							
							
							if (isset($_SESSION['statusMessage']))
								echo "<br />" . $_SESSION['statusMessage'];
							unset($_SESSION['statusMessage']);
						?>
		</div>
	</div>
</form>

 
 
<div id="footer" class="floatcontainer footer">

		<center><a href="">Contact QUEST Team</a></center> 

</div>
 </body></html>